extends ../layout

append css
  link(rel='stylesheet', href='/css/admin.css')
  link(rel='stylesheet', href='/components/sweetalert2/dist/sweetalert2.css')
append beforjs
  script(type="text/javascript", src='/components/sweetalert2/dist/sweetalert2.min.js')    

block main
  .bg(style='background-color:#EEEEEE;')
    block header
      // Static navbar
      nav.navbar.navbar-default.navbar-fixed-top.cnav(style='margin-bottom:0;')
        .container
          .navbar-header
            button.navbar-toggle.collapsed(type='button', data-toggle='collapse', data-target='#navbar', aria-expanded='false', aria-controls='navbar')
              span.sr-only Toggle navigation
              span.icon-bar
              span.icon-bar
              span.icon-bar
            a.navbar-brand(href='#') SKY-Blog
          #navbar.navbar-collapse.collapse
            ul.nav.navbar-nav
              li.active
                a(href='#') 博客首页
            ul.nav.navbar-nav.navbar-right
              //-登录注册
              if(!user) 
                li
                  a(href='/user/login') 登录
                li
                  a(href='/user/register') 注册

              else
                li.dropdown
                  a.dropdown-toggle(href='#', data-toggle='dropdown', role='button', aria-haspopup='true', aria-expanded='false')
                    | 个人信息
                    span.caret
                  ul.dropdown-menu
                    li
                      a(href='#') 我的收藏
                    li
                      a(href='#') 我的博客
                    li.divider(role='separator')
                    li.dropdown-header(style='color:#fff;')
                      h4=user.username
                    li
                      a(href='/admin')
                        i.fa.fa-user-circle
                        |&nbsp;个人设置
                    li
                      a(href='/user/login/out')
                        i.fa.fa-unlock
                        |&nbsp;注销
          //-.nav-collapse

      .container-fluid
        .row
          .col-sm-3.col-md-2.sidebar
            ul.nav.nav-sidebar
              li
                a(href='/admin/articles')
                  | 文章列表
                  span.sr-only (current)
              li
                a(href='/admin/articles/add') 添加文章
              if(user.authority === '管理员')  
                li
                  a(href='/admin/categories') 分类管理
                li
                  a(href='/admin/categories/add') 添加分类
              script(type="text/javascript").
                $(()=>{
                  $('.nav-sidebar').find('a').each(function (){
                    $(this).parent().removeClass('active');
                    if (this.href === document.location.href ){
                        $(this).parent().addClass('active');
                    }
                  });
                })  
             
            ul.nav.nav-sidebar
              li
                a(href='/admin/user/info') 个人信息
              li
                a(href='/admin/user/password') 修改密码
            //  li
            //    a(href='') Another nav item
            //  li
            //    a(href='') More navigation
            //ul.nav.nav-sidebar
            //  li
            //    a(href='') Nav item again
            //  li
            //    a(href='') One more nav
            //  li
            //    a(href='') Another nav item
          .col-sm-9.col-sm-offset-3.col-md-10.col-md-offset-2.main(style='background-color:#FFF;')
            block content
      //

  block footer
    footer.footer.navbar-static-bottom(style='background-color:#FFF;text-align:center; font-color:#FFF;')
      hr.footerhr
      .container
        p.text-muted © CopyRight 2018.03-2018.04, XZQ Inc.All Rights Reserved.
        p.text-muted 联系我们：QQ : 252161732, Address : 南宁学院 
        p.text-muted 基于mongodb大型技术博客分享论坛的设计
